<?php
    session_start();
    //require section
    require_once dirname(dirname(dirname(__FILE__))) . '/shared/config/config.php';

    $email = filter_input(INPUT_POST, "email");
    $item_name = filter_input(INPUT_POST, "product_name");
    $amount_to_deposit = filter_input(INPUT_POST, "amount_to_deposit");
    

    $seller_email = 'vietanh.pd1@gmail.com';
//    $seller_email = api_config::get_skrill_email();
    $buyer_email = $email;
    $return_url = LINK_ROOT . '/cashier.php?t=deposit&result=success';
    $cancel_url = LINK_ROOT . '/cashier.php?t=deposit&result=cancel';
    $status_url = LINK_ROOT . DIR_PAYMENT_SKRILL . '/skrill_status.php';
    $language_code = 'EN';
    $price = $amount_to_deposit;
    $money_code = 'USD';
    $amount_description = '';
    $fname = '';
    $lname = '';
    $buyer_address = '';
    $buyer_city = '';
    $buyer_state = '';
    $buyer_postal_code = '';
    $buyer_country = '';
    $product_name = $item_name;
    $transaction_id = '';
    $product_description = '';
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
    <title>Skrill Payment Gateway</title>
</head>
<body>
<div id="wrap">
    <div id="contentwrap">
        <div id="header">
            <h2 align="center">Redirecting to Skrill payment Gateway </h2>
            <img src="<?php echo LINK_ROOT . DIR_SHARED_LAYOUT_IMAGES_ICONS; ?>ajax-loader.gif"/>
        </div>
        <div id="content">
            <div class="columns">
                <div id="page" class="span12 spaceR">
                    <form action="https://www.moneybookers.com/app/payment.pl" method="post" target="_self" name="Moneybookers">
                        <input type="hidden" name="pay_to_email" value="<?php echo $seller_email; ?>">
                        <input type="hidden" name="pay_from_email" value="<?php echo $buyer_email; ?>">
                        <input type="hidden" name="return_url" value="<?php echo $return_url; ?>">
                        <!-- Redirect to success Page -->
                        <input type="hidden" name="cancel_url" value="<?php echo $cancel_url; ?>">
                        <!-- Redirect To cancel Page-->
                        <input type="hidden" name="status_url" value="<?php echo $status_url; ?>">
                        <!-- Callback purl (backend call) -->
                        <input type="hidden" name="language" value="<?php echo $language_code ?>"> <!-- Language -->
                        <input type="hidden" name="transaction_id" value="<?php echo $transaction_id; ?>">
                        <input type="hidden" name="hide_login" value="1">
                        <!-- show the login form -->

                        <!-- target in which the return_url value will be called on successful payment -->
                        <!-- 1 = '_top', 2 = '_parent', 3 = '_self', 4= '_blank' -->
                        <input type="hidden" name="return_url_target" value="4">
                        <input type="hidden" name="cancel_url_target" value="4">

                        <!-- Custom fields for your own needs -->
                        <!--                        <input type="hidden" name="merchant_fields" value="name, username, order_amount, user_id">-->
                        <!-- List all your custom fields here (comma separated, max 5)-->
                        <!--                        <input type="hidden" name="name" value="name of user">-->
                        <!--                        <input type="hidden" name="username" value="user name">-->
                        <input type="hidden" name="order_amount" value="<?php echo $price; ?>">
                        <!--                        <input type="hidden" name="user_id" value="userid or unique id">-->

                        <input type="hidden" name="amount_description" value="<?php echo $amount_description; ?>">
                        <input type="hidden" name="amount" value="<?php echo $price; ?>">
                        <input type="hidden" name="currency" value="<?php echo $money_code; ?>">
                        <input type="hidden" name="firstname" value="<?php echo $fname; ?>">
                        <input type="hidden" name="lastname" value="<?php echo $lname; ?>">
                        <input type="hidden" name="email" value="<?php echo $buyer_email; ?>">
                        <input type="hidden" name="address" value="<?php echo $buyer_address; ?>">
                        <input type="hidden" name="city" value="<?php echo $buyer_city; ?>">
                        <input type="hidden" name="state" value="<?php echo $buyer_state; ?>">
                        <input type="hidden" name="postal_code" value="<?php echo $buyer_postal_code; ?>">
                        <input type="hidden" name="country" value="<?php echo $buyer_country; ?>">
                        <input type="hidden" name="detail1_description" value="<?php echo $product_name; ?>">
                        <input type="hidden" name="detail1_text" value="<?php echo $product_description; ?>">
                        <input type="hidden" name="confirmation_note" value="Your payment is Success">
                    </form>
                </div>
            </div>
        </div>
    </div>

</div>
<script>
    document.Moneybookers.submit();
</script>
</body>
</html>